
Loader.preShow(function(){
	Y.Node.one("#share_sites").setStyle("height", "0");
});

V.shares = {};
V.amount_of_checked = 0;
V.share_hover = function(e, arg) {
	var myAnim = new Y.Anim.Anim({
		node: "#share_sites",
		to: { height: arg == "in" ? 60 : 0 }
	});
	myAnim.set("duration", 0.2);
	myAnim.set("easing", Y.Anim.Easing.easeOut);

	var myAnim2 = new Y.Anim.Anim({
		node: "#share_area",
		to: { paddingBottom: arg == "in" ? 0 : 10 }
	});
	myAnim2.set("duration", 0.2);
	myAnim2.set("easing", Y.Anim.Easing.easeOut);

	myAnim.run();
	myAnim2.run();
};

Loader.onReady(function() {

/*
	Y.Node.one("#start_page_link").on("click", function() {
		var myAnim = new Y.Anim.Anim({
			node: "#content",
			to: {
				left: 0
			}
		});
		myAnim.set("duration", 0.4);
		myAnim.set("easing", Y.Anim.Easing.easeOut);
		myAnim.run();
	});
*/

	V.share_mouseenter_event = Y.Event.on("mouseenter", V.share_hover, "#share_area", null, "in");
	V.share_mouseleave_event = Y.Event.on("mouseleave", V.share_hover, "#share_area", null, "out");
	Y.Node.all("#share_sites li").each(function() {
		this.on("click", function() {
			Util.replaceNodeClass(this.one("div"), "checkbox_on", "checkbox_off");

			V.shares[this.get("id")] = !V.shares[this.get("id")];
			V.shares[this.get("id")] ? V.amount_of_checked++ : V.amount_of_checked--;

			V.share_mouseenter_event.detach();
			V.share_mouseleave_event.detach();
			if (V.amount_of_checked == 0) {
				V.share_mouseenter_event = Y.Event.on("mouseenter", V.share_hover, "#share_area", null, "in");
				V.share_mouseleave_event = Y.Event.on("mouseleave", V.share_hover, "#share_area", null, "out");
				Y.Node.one("#share_area").setStyle("backgroundColor", "");
			} else {
				Y.Node.one("#share_area").setStyle("backgroundColor", "#D7DFF5");
			}
		});
	});

	var first_input = Y.Node.one("#item_title");
	first_input.focus();

	Util.set_def_values([
		{
			id: "item_title",
			def_text: "product title..."
		}, {
			id: "manufacture_title",
			def_text: "title..."
		}, {
			id: "thing_text",
			def_text: "More description comes here..."
		}
	]);


});
